#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
void reverse(char* left, char* right)
{
    while (left < right)
    {
        char tmp = 0;
        tmp = *left;
        *left = *right;
        *right = tmp;
        left++;
        right--;
    }
}

int main()
{
    char arr[100] = { 0 };
    gets(arr);
    int len = strlen(arr);
    reverse(arr, arr + len - 1);
    char* left = arr;
    while (*left)
    {
        char* right = left;
        while (*right != ' ' && *end)
            end++;
        reverse(left, right - 1);
        if (*right)
            left = right + 1;
        else
            left = right;
    }
    printf("%s\n", arr);

    return 0;
}